package com.bb.blog.web.component;

import java.util.Random;

public class RandomCodeGenerator {
    private static String RANDOM_STR = "123456789qwertyuiopasdfghjklzxcvbnm";

    public static String randomCode(int num){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < num; i++) {
            int j = (int) Math.floor(Math.random() *  RANDOM_STR.length());
            char c = RANDOM_STR.charAt(j);
            sb.append(c);
        }
        return sb.toString();
    }

}
